package com.kingsalert.kingsalert.bean.config;

import android.content.Context;
import android.graphics.Bitmap;
import android.text.TextUtils;

import com.google.gson.Gson;
import com.kingsalert.kingsalert.R;

public class RecommendAppInfo {

    private String title;
    private String text;
    private String appName;
    private String amountText;
    private String score;
    private String downloads;
    private String logo;
    private String path;

    private Bitmap logoBitmap;

    private RecommendAppInfo(){}

    public static RecommendAppInfo getInstance(String jsonStr){
        return new Gson().fromJson(jsonStr,RecommendAppInfo.class);
    }

    public String getTitle(Context context) {
        if (TextUtils.isEmpty(title)) return context.getString(R.string.ln_wait_recommended_title);
        return title;
    }

    public String getText(Context context) {
        if (TextUtils.isEmpty(text)) return context.getString(R.string.ln_wait_recommended_text);
        return text;
    }

    public String getAppName() {
        if (TextUtils.isEmpty(appName)) return "";
        return appName;
    }

    public String getAmountText() {
        if (TextUtils.isEmpty(amountText)) return "";
        return amountText;
    }

    public String getScore() {
        if (TextUtils.isEmpty(score)) return "";
        return score;
    }

    public String getDownloads() {
        if (TextUtils.isEmpty(downloads)) return "";
        return downloads;
    }

    public String getLogo() {
        if (TextUtils.isEmpty(logo)) return "";
        return logo;
    }

    public String getPath() {
        if (TextUtils.isEmpty(path)) return "";
        return path;
    }

    public Bitmap getLogoBitmap() {
        return logoBitmap;
    }

    public void setLogoBitmap(Bitmap logoBitmap) {
        this.logoBitmap = logoBitmap;
    }
}
